package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;
import com.corona.game.util.SmolSprite;
import com.corona.game.util.TextureCache;
import java.util.ArrayList;

/* compiled from: Player.java */
/* access modifiers changed from: package-private */
/* loaded from: pokewilds.jar:com/pkmngen/game/PlantTree.class */
public class PlantTree extends Action {
    public Action.Layer layer;
    String type;
    Vector2 pos;
    ArrayList<SmolSprite> sprites;
    int timer;
    Tile currTile;

    public PlantTree(Vector2 pos, Action nextAction) {
        this("tree_planted2", pos, nextAction);
    }

    public PlantTree(String type, Vector2 pos, Action nextAction) {
        super(new Object[0]);
        this.layer = Action.Layer.gui_0;
        this.sprites = new ArrayList<>();
        this.timer = 0;
        this.type = type;
        this.pos = pos;
        this.nextAction = nextAction;
        Texture text = TextureCache.get(Gdx.files.internal("sprout_sheet2.png"));
        for (int i = 0; i < 5; i++) {
            SmolSprite sprite = new SmolSprite(text, 16 * i, 0, 16, 16);
            sprite.setPosition(pos.x, pos.y + 2.0f);
            this.sprites.add(sprite);
        }
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void firstStep(Game game) {
        this.currTile = game.map.tiles.get(this.pos);
        this.currTile.nameUpper = "tree_planted2";
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        Player.drawSproutSprite = false;
        if (this.timer == 0) {
            this.currTile.overSprite = this.sprites.get(0);
        } else if (this.timer == 12) {
            this.currTile.overSprite = this.sprites.get(1);
        } else if (this.timer == 15) {
            this.currTile.overSprite = this.sprites.get(2);
        } else if (this.timer == 18) {
            this.currTile.overSprite = this.sprites.get(3);
        } else if (this.timer == 21) {
            this.currTile.overSprite = this.sprites.get(4);
        } else if (this.timer == 24) {
            Player.drawSproutSprite = true;
            game.map.tiles.put(this.pos.cpy(), new Tile(this.currTile.name, this.type, this.pos.cpy(), true, this.currTile.routeBelongsTo));
            game.actionStack.remove(this);
            game.insertAction(this.nextAction);
        }
        this.timer++;
    }
}
